package org.taobao.ibatiside.ui.action;

import org.eclipse.datatools.sqltools.sqleditor.ISQLEditorActionContributorExtension;
import org.eclipse.datatools.sqltools.sqleditor.SQLEditor;
import org.eclipse.datatools.sqltools.sqleditor.SQLEditorActionContributorExtension;
import org.eclipse.jface.action.IMenuManager;

public class SQLEditorActionExtension extends SQLEditorActionContributorExtension implements
		ISQLEditorActionContributorExtension {
	SqlEditorAction createnew;
	public SQLEditorActionExtension() {
		super();
		createnew = new SqlEditorNewStmtAction();
	}
	@Override
	public void setActiveEditor(SQLEditor targetEditor) {
		super.setActiveEditor(targetEditor);
		createnew.setEditor(targetEditor);
	}
	@Override
	public void contributeToContextMenu(IMenuManager mm) {
		mm.add(createnew);
	}
	@Override
	public void updateAction() {
		createnew.update();
	}
	@Override
	public void updateAction(boolean isSQLEditorPage) {
		createnew.update(isSQLEditorPage);
	}
	@Override
	public void dispose() {
		createnew.dispose();
	}
}
